﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace NameResolver
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DataContext = App.ViewModel;
            Loaded += (_1, _2) => { PeerResolver.Start(); };
        }

        private void Window_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
        	switch (e.Key)
            {
                case Key.F1:
                    if (frmMain.Content is Page_Main) return;
                    frmMain.NavigationService.Navigate(new Page_Main());
                    break;
                case Key.F2:
                    if (frmMain.Content is Page_Settings) return;
                    frmMain.NavigationService.Navigate(new Page_Settings());
                    break;
                case Key.F5:
                    e.Handled = true;
                    return;
                    break;
            }
        }
    }
}
